package org.onion.pattern.kit.springtool.converter;

import org.springframework.core.convert.converter.Converter;

import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;

public class Long2LocalDateConvert implements Converter<Long, LocalDate> {

    @Override
    public LocalDate convert(Long s) {
        if (s <= 0) {
            return LocalDate.MIN;
        }

        return LocalDate.ofInstant(Instant.ofEpochMilli(s), ZoneId.systemDefault());
    }


}
